Skip to content

feat: add Manual Dispatch Panel for triggering equipment operations v…#59

Merged
H4S1NTH4 merged 1 commit into
mainfrom
hasintha/fix/manual-eq-trigger
May 1, 2026
Merged

feat: add Manual Dispatch Panel for triggering equipment operations v…#59
H4S1NTH4 merged 1 commit into
mainfrom
hasintha/fix/manual-eq-trigger

Conversation

@H4S1NTH4
Copy link
Copy Markdown
Collaborator

@H4S1NTH4 H4S1NTH4 commented May 1, 2026

…ia MQTT

Summary by CodeRabbit

Release Notes

  • New Features
    • New manual equipment dispatch interface allows admins to select equipment, choose operations, preview MQTT topics, and execute control commands. Includes validation, loading feedback, success confirmations with operation and equipment details, and robust error handling for both API and unexpected failures. Equipment data is automatically refreshed after dispatch.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agri-wizard Ready Ready Preview, Comment May 1, 2026 10:52pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b0ed8bf8-9a4d-40d8-bf2e-a1d92bfd9aec

📥 Commits

Reviewing files that changed from the base of the PR and between eac27f1 and f11441f.

📒 Files selected for processing (1)
  • client/app/(dashboard)/admin/equipment/page.tsx

📝 Walkthrough

Walkthrough

A new admin page component enables manual equipment dispatch, allowing selection of equipment and operations with MQTT topic preview. The feature validates selections, calls the control API, handles success and error states with appropriate toast notifications, and refreshes the equipment cache after dispatch.

Changes

Cohort / File(s) Summary
Manual Equipment Dispatch Feature
client/app/(dashboard)/admin/equipment/page.tsx
New page component implementing admin UI for manual equipment dispatch with equipment/operation selection, MQTT preview, validation, API integration, error handling, and cache refresh logic.

Sequence Diagram

sequenceDiagram
    actor Admin
    participant UI as Equipment Dispatch UI
    participant API as hardwareApi
    participant Backend as Server
    participant Cache as Equipment Cache

    Admin->>UI: Select equipment & operation
    Admin->>UI: Preview MQTT topic
    Admin->>UI: Click dispatch
    
    UI->>UI: Validate selection
    alt Validation fails
        UI->>Admin: Show error toast
    else Validation passes
        UI->>UI: Set isDispatching=true
        UI->>API: controlEquipment(equipmentId, {operation})
        API->>Backend: POST dispatch command
        
        alt Success
            Backend-->>API: Command accepted
            API-->>UI: Success response
            UI->>Cache: mutate("equipment")
            Cache-->>UI: Equipment list refreshed
            UI->>Admin: Show success toast
        else Error (ApiError)
            Backend-->>API: ApiError response
            API-->>UI: Error details
            UI->>Admin: Show API error toast
        else Error (Unexpected)
            API-->>UI: Unexpected error
            UI->>Admin: Show generic error toast
        end
        
        UI->>UI: Clear selections
        UI->>UI: Set isDispatching=false
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new dispatch takes flight,
Equipment bends to admin's might,
With MQTT paths so bright,
And toasts that glow just right,
The cache hops along tonight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hasintha/fix/manual-eq-trigger

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@H4S1NTH4 H4S1NTH4 merged commit 3e2ddb6 into main May 1, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant